package com.laixu.estore.web.controller;

import com.laixu.estore.bean.vo.CategoryTreeVo;

import com.laixu.estore.service.CategoryService;
import com.laixu.estore.web.response.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController // 返回json数据
@RequestMapping("category") // /category/list
@RequiredArgsConstructor
public class CategoryController {
    private final CategoryService categoryService;

    @GetMapping("list")
//    @RequestMapping(value = "list",method = RequestMethod.GET)
    public Result list(){
        // 调用service
        List<CategoryTreeVo> list =  categoryService.list();
        return Result.success(list);
    }
}